﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ResourceManagement.ObjectModel;
using Microsoft.ResourceManagement.ObjectModel.ResourceTypes;

namespace Microsoft.ResourceManagement.Client
{
    public class DefaultResourceTypeFactory : IResourceTypeFactory
    {
        #region IResourceTypeFactory Members

        public virtual RmResource CreateResource(string resourceType)
        {
            if (String.IsNullOrEmpty(resourceType))
            {
                return new RmResource();
            }
            String upperCaseResourceType = resourceType.ToUpperInvariant();
            switch (upperCaseResourceType)
            {
                case @"GROUP":
                    return new RmGroup();
                case @"PERSON":
                    return new RmPerson();
                default:
                    return new RmResource();
            }
        }

        #endregion
    }
}
